import 'package:flustars/flustars.dart';
import 'package:lishopflu/base/view_import.dart';
import 'package:lishopflu/entity/address_bean.dart';
import 'package:lishopflu/base/controller_import.dart';


class AddressManageCtl extends BaseListController<AddressBean>{

  @override
  void onFirst() {
    if(appArguments!=null && appArguments.obj!=null){

    }
    callRefresh();
  }

  @override
  void getList(FutureOr<AddressBean> Function(List<AddressBean> value) onValue) {
    LocalJson.addressList().then((value){
      List<AddressBean> pause = [];
      pause.addAll(JsonUtil.getObjList(value, (v) => AddressBean.fromJson(v)));
      onValue.call(pause);
    });
  }

  @override
  void onDestroy() {

  }

  void toAdd() => Get.toNamed(AppPages.ADD_ADDRESS);

  void toEdit(AddressBean item) => Get.toNamed(AppPages.ADD_ADDRESS, arguments: AppArguments(obj: item));
}